function updateSystemInfo() {
    // 通过 AJAX 获取系统资源数据
    $.ajax({
        url: '/api/system/resources',
        method: 'GET',
        success: function(data) {
            $('#cpu-usage').text(data.cpu.percent + '%');
            $('#memory-usage').text(data.memory.percent + '%');
            $('#disk-usage').text(data.disk.percent + '%');
            $('#running-scripts').text(data.running_scripts);
        },
        error: function(xhr, status, error) {
            console.error('获取系统信息失败:', error);
        }
    });
}

// 每5秒更新一次数据
$(document).ready(function() {
    updateSystemInfo();
    setInterval(updateSystemInfo, 5000);
}); 